package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.LogBean;
import com.project.service.ILogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

@RestController
@RequestMapping("log")
@Api(tags = "日志控制器")
public class LogController {
    @Autowired
    private ILogService logService;
    @ApiOperation(value = "动态分页查询日志信息",notes = "按页码，起始日期、结束日期动态分页查询日志信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name="pageNO",value = "页码",required = true),
            @ApiImplicitParam(name="startDate",value = "起始日期"),
            @ApiImplicitParam(name="endDate",value = "结束日期")
    })
    @RequestMapping("cutByItem")
    @RequiresPermissions("log:*")
    public IPage<LogBean> cutByItem(Integer pageNO, LocalDate startDate, LocalDate endDate){
      return  logService.cutByItem(pageNO,startDate,endDate);
    }
}
